package com.listviewcheckbox;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class MainActivity extends Activity {

	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		String[] cons= {"12345678", "09876543", "qwertyuiop", "poiuytrewq","12345678", "09876543", "qwertyuiop", "poiuytrewq",
				"12345678", "09876543", "qwertyuiop", "12345678", "09876543", "qwertyuiop", "poiuytrewq", "poiuytrewq"};
		final ListView listView= (ListView) findViewById(R.id.listView);
		final MyAdapter adapter= new MyAdapter(this, cons);
		listView.setAdapter(adapter);
		listView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {

				listAnimation(true, listView);
				adapter.setAdapterCheckBoxListener(position);
				adapter.notifyDataSetChanged();
			}
		});
	}
	
	public void listAnimation(boolean falg, ListView list) {
		
		Animation animation= new TranslateAnimation(0.1f, -100.0f,0.0f,0.0f);
		animation.setDuration(1000);
		list.setAnimation(animation);
		list.startAnimation(animation);
	}
}